#include "login.h"
#include "ui_login.h"
#include <QMessageBox>
#include "randomrunner.h"

Login::Login(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Login)
{
    ui->setupUi(this);
}

Login::~Login()
{
    delete ui;
}

void Login::on_buttonBox_rejected()
{
    exit(-1);
}

void Login::on_buttonBox_accepted()
{
    int people = ui->peoplecount->value();
    int runinterval = ui->runinterval->value();
    double stopmin = ui->stopmin->value();
    double stopmax = ui->stopmax->value();
    if (stopmax <= stopmin){
        QMessageBox::warning(nullptr, "警告", "最小时间必须小于最大时间！");
    }
    else {
        RandomRunner randomrunner(people, runinterval, stopmin, stopmax);
        randomrunner.exec();
    }
}
